import request from '@/utils/request'
import type{ QueryParams, RuleForm } from "@/views/store/table/types";
// 查询所有餐桌
export function listAllTable() {
  return request({
    url: '/table/listAll',
    method: 'get'
  })
}

// 查询餐桌列表
export function listTable(query: QueryParams) {
  return request({
    url: '/table',
    method: 'get',
    params: query
  })
}

// 分页查询餐桌列表
export function listTableByPage(query: QueryParams) {
  return request({
    url: '/table/page',
    method: 'get',
    params: query
  })
}

// 根据id查询餐桌
export function getTableById(tableId: string) {
  return request({
    url: '/table/' + tableId,
    method: 'get'
  })
}

// 根据状态查询餐桌
export function getTableByStatus(status: string) {
  return request({
    url: '/table/getByStatus/' + status,
    method: 'get'
  })
}

// 新增餐桌
export function addTable(data: RuleForm) {
  return request({
    url: '/table',
    method: 'post',
    data: data
  })
}

// 修改餐桌
export function updateTable(data: RuleForm) {
  return request({
    url: '/table',
    method: 'put',
    data: data
  })
}

// 删除餐桌
export function deleteTable(tableId: string) {
  return request({
    url: '/table/' + tableId,
    method: 'delete'
  })
}

// 批量删除餐桌
export function deleteTableBatch(tableIds: string[]) {
  return request({
    url: '/table/delBatch/' + tableIds,
    method: 'delete'
  })
}
